/**
 * 
 */
package dataTypes;

import io.ISequenceReader;

import java.io.IOException;

/**
 * @author christian
 * 
 */
public class Cluster {
	ISequenceData[] seq;
	String[] seqName;
	private boolean populated = false;
	int numOfSeqs = 0;

	public Cluster(String[] seqNames) throws IOException {
		this.seqName = seqNames;
		this.numOfSeqs = seqNames.length;
	}

	public String getRepresentative() {
		return seqName[0] + " (" + numOfSeqs + ")";
	}

	public String toString() {
		String toReturn = "";

		if (populated) {
			toReturn = "Populated with the seuences:\n";
		} else {
			toReturn = "Unpopulated, containing the seqences:\n";
		}

		for (int i = 0; i < seqName.length; i++) {
			toReturn += seqName[i] + " ";
		}
		return toReturn;
	}

	public void populate(ISequenceReader reader) throws IOException {
		seq = new ISequenceData[numOfSeqs];
		for (int i = 0; i < numOfSeqs; i++) {
			seq[i] = reader.loadSequence(seqName[i]);
		}
	}
}
